<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$form = $this->beginWidget('CActiveForm', array(
    "id" => "manage-addRole-form",
    'enableAjaxValidation' => FALSE,
    'htmlOptions' => array('class' => '', 'role' => 'form'),
        ));
?>
<ul class="breadcrumb">
    <li><?php
echo $control->getAjaxLink('功能角色列表', array(
    'cooker' => 'BAEvent@showEventRoleList'
));
?> <span class="divider">\</span></li>
    <li>添加功能角色</li>
</ul>
<div class="">
    <div class="roleList">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th></th>
                    <th>角色名称</th>
                    <th>角色别名</th>
                    <th>所属应用</th>
                    <th>选择首页</th>
                    <th>手机模版</th>
                </tr>
            </thead>
            <tbody>
                <?php
                $eventCooker = new BAEventCooker();
                $eventHomeList = $eventCooker->getEventHomeList();
                $mobileThemeList = array(
                    '0' => '没有模版',
                    'mb_bootstrap' => 'mb_bootstrap'
                );
                foreach ($roleListData as $id => $role) {
                    $roleName = $role->getName();
                    $roleFullName = $role->getFullName();
                    $roleAlias = BARoleCooker::getRoleAliasByFullName($roleFullName);
                    $appId = $role->appId;
                    $appClass = BApp::getAppClassById($appId);
                    ?>
                    <tr>
                        <td><?php echo CHtml::activeCheckBox($model, "[$id]isChecked"); ?></td>
                        <td><?php echo $roleName; ?></td>
                        <td><?php echo $roleAlias; ?></td>
                        <td><?php echo yii::t('site', $appClass); ?></td>
                        <td><?php echo CHtml::activeDropDownList($model, "[$id]eventHome", $eventHomeList, array('class' => 'span12')); ?></td>
                        <td><?php echo CHtml::activeDropDownList($model, "[$id]mobileTheme", $mobileThemeList, array('class' => 'span12')); ?></td>
                    </tr>

                <?php } ?>
            </tbody>
        </table>
    </div>
    <div>
        <?php
        echo $control->getAjaxLink('添加功能角色', array(
            'cooker' => 'BAEventCooker@addEventRole',
            'htmlOptions' => array(
                'class' => 'btn'
        )));
        ?>
    </div>
</div>
<?php $this->endWidget(); ?>